<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" href="/css/login.css">
    <script src="/js/jquery-1.11.3.min.js"></script>
    <script src="/js/login.js"></script>
</head>
<body>
<div class="login-panel" id="login-panel">
    <form id="login-form" onsubmit="return false" autocomplete="false" method="post">
        <div class="col-lg-12" style="text-align: center;font-size: 20px;padding-bottom: 10px;">
            登录
        </div>
        <div class="input-item">
            <input type="text" name="username" id="username" placeholder="请输入账号"/>
        </div>
        <div class="input-item">
            <input type="password" name="password" id="password" placeholder="请输入密码"/>
        </div>
        <div class="input-item">
            <img src="/captcha.jpg" onclick="refresh(this)">
            <br>
            <input type="text" id="kaptcha" required lay-verify="required" placeholder="请输入验证码" autocomplete="off"
                   class="layui-input">
        </div>
        <div class="input-item">
            <!-- <input type="checkbox" name="remember-me" value="true"/>记住我-->
            <a onclick="login()" id="login"> 登录</a>
            <!--<button tye="button" onclick="login()">登录</button>-->
        </div>
        <div class="input-item">
            <a href="####" class="btn btn-forget-password">忘记密码?</a>
            <a href="####" class="btn btn-register">注册帐号?</a>
        </div>
    </form>
</div>
</div>
</body>
<script>
    function refresh(obj) {
        obj.src = "captcha.jpg?t=" + new Date().getMilliseconds();
    }

    function login() {
        $.post("/userLogin", {
            username: $("#username").val(),
            password: $("#password").val(),
            kaptcha: $("#kaptcha").val()
            //"remember-me": true
        }, function (data) {
            console.log(data);
            if (data.code == 200) {
                location.href = "/home.html";
            }
        });
    }

</script>
</html>